package agend.behaviuors.android;

import jade.core.AID;
import jade.core.behaviours.OneShotBehaviour;
import jade.lang.acl.ACLMessage;

public class AndroidCredentialBheaviour extends OneShotBehaviour {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int performativa;
	private AID receiver;
	
	public AndroidCredentialBheaviour(int performativa, AID receiver) {
		
		this.performativa = performativa;
		this.receiver = receiver;
	}
	
	@Override
	public void action() {
		
		ACLMessage aclMessage = new ACLMessage(performativa);
		aclMessage.setSender(myAgent.getAID());
		aclMessage.addReceiver(receiver);
		aclMessage.setConversationId("Credential");
		
		if( performativa == ACLMessage.CONFIRM )
			aclMessage.setContent("Credenziali Valide");
		else if( performativa == ACLMessage.FAILURE )
			aclMessage.setContent("Credenziali non Valide");
		
		myAgent.send(aclMessage);
	}

}
